package ru.st.selenium.pages;


import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import ru.st.selenium.applogic2.ApplicationManager2;
import ru.st.selenium.applogic2.NavigationHelper2;

public class SimpleMoviePage extends AnyPage {

    public SimpleMoviePage(PageManager pages) {
        super(pages);
    }

    @FindBy(xpath = "//h2")
    private WebElement movieName;

    @FindBy(xpath = "//img[@title='Remove']")
    private WebElement deleteBtn;

    public String getMovieName() {
        return movieName.getText();
    }

    public HomePage removeMovie() {
        deleteBtn.click();
        new NavigationHelper2(new ApplicationManager2()).acceptAlert();
        return pages.homePage;
    }

}
